<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title><s:if test="content.contentId==null"><s:text name="content.add.title"/></s:if><s:else><s:text name="content.edit.title"/></s:else></title>
	<%@ include file="/common/meta.jsp"%>
	<%@ include file="/common/common.jsp"%>
	<script type="text/javascript" src="${ctx}/js/My97DatePicker/WdatePicker.js"></script>

</head>
<body>
<div id="wrapper">
	<div class="curmb"><s:text name="your.site.position"/>:<a href="${ctx}/welcome.action"><s:text name="homepage"/></a><span>></span><s:text name="content.title"/></div>
	<div class="listtit"><p><span><strong><s:if test="linkContent.contentId==null"><s:text name="content.add.title"/></s:if>
	<s:elseif test="cflag!=null&&cflag.equals(\"1\")">内容审核</s:elseif>
				<s:else><s:text name="content.edit.title"/></s:else> 
	</strong></span></p></div>
	<div class="listadd">
		<%-- <s:form action="content-upload"  enctype="multipart/form-data" method="post" onsubmit="return chkform()"> --%>
		<s:form action="linkcontent-save" onsubmit="return chkform()" id="save-form">
		<s:hidden name="cflag"/>
		<s:hidden name="linkContent.contentId"/>
		<s:hidden name="linkContent.category.categoryId"/>
		<s:hidden name="linkContent.showType"/>
		<s:hidden name="linkContent.isTop"/>
		<s:hidden name="topic.topicId"/>
		<s:hidden name="content.contentStatus"/>
		<s:hidden name="content.publishSug"/>
		<s:hidden name="pictureDbPath"></s:hidden>
		<s:hidden name="picturePhysicalPath"></s:hidden>
		<s:hidden name="attachName"></s:hidden>
		<s:hidden name="attachType"></s:hidden>
		<s:hidden name="attachExt"></s:hidden>
		<s:hidden name="attachUrl" id="attachUrl"></s:hidden>
		<s:hidden name="attachSize"></s:hidden>
		<s:hidden name="attachMemo"></s:hidden>
		<s:hidden name="uploadOriginName"></s:hidden>
		
		<table class="addgrid">
			<s:if test="topic.topicName!=null">
			<tr>
				<th><s:text name="content.cmsTopic"/>:</th>
				<td><s:text name="topic.topicName"/></td>
			</tr>
			</s:if><s:else>
			<tr>
				<th><s:text name="content.cmsCategory"/>:</th>
				<td><s:property value="linkContent.category.catName"/></td>
			</tr>
			</s:else>
			<tr>
				<th><span id="linkUrlno" style="color: red;">*</span><s:text name="content.contentTitle"/>:</th>
				<td><s:textfield id="contentTitle" name="linkContent.contentTitle" required="true" requiredposition="right" cssClass="txtin" /><span id="contentTitleno"></span><a href="#this" onclick="addSimpleTitle()">*添加文章副标题</a><span id="catContentTitleAlert" style="color :red"><s:property value="linkContent.category.catContentTitleAlert"/></span></td>
			</tr>
			<tr id="simpleT_1">
				<th>文章副标题:</th>
				<td><s:textfield  id="content.simpleTitle1" name="linkContent.simpleTitle1" cssClass="txtin450" onblur="simpleTitle1(this)"/><a href="#this" onclick="removeSimpleTitle('simpleT_1')">删除文章副标题</a></td>
			</tr>
			<tr id="simpleT_2">
				<th>文章副标题:</th>
				<td><s:textfield id="content.simpleTitle2" name="linkContent.simpleTitle2" cssClass="txtin450" onblur="simpleTitle2(this)"/><a href="#this" onclick="removeSimpleTitle('simpleT_2')">删除文章副标题</a></td>
			</tr>
			<tr id="simpleT_3">
				<th>文章副标题:</th>
				<td><s:textfield id="content.simpleTitle3" name="linkContent.simpleTitle3" cssClass="txtin450" onblur="simpleTitle3(this)"/><a href="#this" onclick="removeSimpleTitle('simpleT_3')">删除文章副标题</a></td>
			</tr>
			<tr>
				<th>自定义属性:</th>
				<td>
					<input type="checkbox" name="isTop_f">置顶</input>
					<input type="checkbox" name="showType_o">最新</input>
					<input type="checkbox" name="showType_o">推荐</input>
					<input type="checkbox" name="showType_o">精选</input>
					<input type="checkbox" name="showType_o">热点</input>
					<input type="checkbox" name="showType_o">图片</input>
				</td>
			</tr>
			<tr>
				<th><span id="linkUrlno" style="color: red;">*</span><s:text name="content.linkUrl"/>:</th>
				<td><s:textfield name="linkContent.linkUrl"  id="linkUrl" required="true" requiredposition="right" cssClass="txtin"/><span id="keywordsno">外部链接地址必须以http://开头，否则认为为相对地址</span></td>
			</tr>
			<tr>
				<th><s:text name="content.contentAuthor"/>:</th>
				<td><s:textfield id="linkContent.contentAuthor" name="content.contentAuthor" required="true" requiredposition="right" cssClass="txtin" onblur="contentAuthor(this)"/></td>
			</tr>
			<tr>
				<th><s:text name="key.words"/>:</th>
				<td><s:textfield id="keywords" name="linkContent.keywords" required="true" requiredposition="right" cssClass="txtin"/><span id="keywordsno">多个关键字请以','隔开</span></td>
			</tr>
			<tr>
				<th><span id="contentDescriptionno" style="color:red">*</span><s:text name="content.contentDescription"/>:</th>
				<td><s:textfield id="contentDescription" onblur="checkDes()" name="linkContent.contentDescription" required="true" requiredposition="right" cssClass="txtin"/><span id="desPoint"></span></td>
			</tr>
			<tr>
				<th><s:text name="content.contentTpl"/>:</th>
				<td>
					<s:if test="linkContent.category.categoryId!=''"><s:select name="content.contentTpl" list="contenttpllist" /></s:if>
					<s:else><s:select name="content.contentTpl" list="toptpllist" /></s:else>
				</td>
			</tr>
			<tr>
				<th><span id="contentDescriptionno" style="color:red">*</span><s:text name="content.contentSource"/>:</th>
				<td><s:textfield id="contentSource" name="linkContent.contentSource" required="true" requiredposition="right" cssClass="txtin"/><span id="contentSourceno"></span></td>
			</tr>
			<tr >
				<th><span id="pictureupload" style="color:red">*</span>上传图片</th>
				<td id="before">
					<div class="loadtit"><span class="	">（单个文件上传大小不能超过2M）</span><a class="loadpicbtn" onclick="up1()" href="#this" style="display: none" id="insert">插入</a></div>
					<div class="loadmain" id="selectPic">
						<div class="loadway">
							<input type="button" class="loadwaypic" onclick="up1()" onmousemove="$('input[name=uploadType]').val(1);document.getElementById('bester').style.pixelLeft=event.x-60;document.getElementById('bester').style.pixelTop=event.y-10;"/>
							<p>（文件格式必须为jpg/png/gif/jpeg）</p>
						</div>
					</div>
					<div class="t_img3" id="preview_fake" style="display: none">
		                 <s:if test="attachUrl!=null">
		                 	<img src="<s:property value="uploadUrl"/><s:property value="attachUrl"/>" title="<s:text name="site.banner"/>" id="pictemp2" />
		                 </s:if>
		                 <s:else> 
		                 	<img src="${ctx}/imgs/front/zw_tu.png" title="<s:text name="site.banner"/>"  id="pictemp2"  />
		                 </s:else>
               		</div>
				</td>
				<td id="uploads">
					
				</td>
			</tr>
			<s:if test="cflag!=null&&cflag.equals(\"1\")">
				<tr>
					<th>创建时间:</th>
					<td><s:date name="linkContent.createTime" format="yyyy年MM月dd日   HH:mm:ss" /></td>
				</tr>
				<tr>
					<th>修改时间:</th>
					<td><s:date name="linkContent.updateTime" format="yyyy年MM月dd日 HH:mm:ss" /></td>
				</tr>
				<tr>
					<th>发布时间:</th>
					<td><input name="linkContent.publishTime" size="30" class="Wdate" id="qry_startTime_4" readonly="true"  value="<s:date name="linkContent.publishTime" format="yyyy-MM-dd HH:mm:ss"/>"
							onFocus="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd HH:mm:ss'})" type="text"/></td>
				</tr>
				<tr>
					<th>发布类型:</th>
					<td>
						发布到：<s:select list="dicPublishType" value="linkContent.publishType" name="linkContent.publishType" cssClass="selectClass" listKey="dictionaryKey" listValue="dictionaryValue"/></td>
				</tr>
				<tr>
					<th>操作日志:</th>
					<td><a href="#this" id="operLog">查看操作日志</a></td>
				</tr>
				<tr>
					<th>审核:</th>
					<td>
					<s:select list="dicAudit" value="linkContent.contentStatus" headerKey="" headerValue="--请选择--" name="linkContent.contentStatus" cssClass="selectClass" listKey="dictionaryKey" listValue="dictionaryValue"/>
					<span id="audit_status" style="color:red;display:none;">请选择!</span>
					</td>
				</tr>
				<tr>
					<th><s:text name="content.publishSug"/>:</th>
					<td><s:textarea cols="140" rows="4"  name="linkContent.publishSug" required="true" requiredposition="right" /><span id="keywordssug" style="color:red">请输入审核意见!</span></td>
				</tr>
			</s:if><s:else>
				<tr>
					<th>创建时间:</th>
					<td><s:if test="linkContent.createTime!=null"><s:date name="content.createTime" format="yyyy年MM月dd日 HH:mm:ss" /></s:if>
						<s:else><s:date name="linkContent.publishTime" format="yyyy年MM月dd日  HH:mm:ss" /></s:else>
					</td>
				</tr>
				<tr>
					<th>修改时间:</th>
					<td><s:date name="softwareContent.updateTime" format="yyyy年MM月dd日 HH:mm:ss" /></td>
				</tr>
				<tr>
					<th>发布时间:</th>
					<td><input name="linkContent.publishTime" size="30"  class="Wdate" id="qry_startTime_1" readonly="true"  value="<s:date name="linkContent.publishTime" format="yyyy-MM-dd HH:mm:ss"/>"
							onFocus="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd HH:mm:ss'})" type="text"/></td>
				</tr>
				<tr>
					<th>审核:</th>
					<td> 
						<s:if test="linkContent.contentStatus==1">审核通过</s:if>
						<s:elseif test="linkContent.contentStatus==2">审核未通过</s:elseif>
						<s:else>未审核</s:else>
					</td> 
				</tr>
				<tr>
					<th>审核意见:</th>
					<td> <s:property  value="linkContent.publishSug"  /></td>					 
				</tr>				
				<tr>
					<th>发布类型:</th>
					<td>
						发布到：<s:select list="dicPublishType" value="linkContent.publishType" name="linkContent.publishType" cssClass="selectClass" listKey="dictionaryKey" listValue="dictionaryValue"/></td>
				</tr>
			</s:else>
 
			<tr>
				<th>&nbsp;</th>
				<td><s:if test="cflag!=null&&cflag.equals(\"1\")"><input type="button" value="<s:text name="save"/>" class="btnlist2" onclick="goAudit()"/></s:if>
					<s:elseif test="%{authLicence('3_3_3',content.category.categoryId)}">
					  <s:submit value="%{getText('save')}" cssClass="btnlist2" id="save"/>
					</s:elseif>
					<s:elseif test="%{authLicence('4_4_3',topic.topicId)}">
					  <s:submit value="%{getText('save')}" cssClass="btnlist2" id="save" />
					</s:elseif>
					<s:else>
						<s:submit value="%{getText('save')}" cssClass="btnlist2" id="save"/>
					</s:else>
				<s:submit value="%{getText('preview')}" cssClass="btnlist2"/><s:reset value="%{getText('reset')}" cssClass="btnlist2"/><input type="button" value="返回" class="btnlist2" onclick="javascript:history.go(-1);"/></td>
			</tr>
			<!-- <tr>
				<th><input type="file" value="浏览" name="upload" /></th>
				<td><input type="submit" value="提交"/>  </td>
			</tr> -->
		</table>
		</s:form>
	</div>
</div>
<div id="lightbox" class="lightbox" >
	<div class="lighttit"><p><span><input type="button" value="&nbsp;" id="lightclose" class="lightclose" /><strong>操作日志</strong></span></p></div>
	<div class="lightmain">
		<div class="lightmaintit">操作日志查看</div>
		<div class="ilghtmainbox" style="OVERFLOW-y:auto;OVERFLOW:scroll;overflow-x:auto;">
			<div id="authorSetDiv" >
				<table class="listgridb" cellspacing="1" id="listbox">
					<tbody>
						<tr>
						 
							<th>时间</th>
							<th>IP地址</th>
							<th>用户</th>
							<th>操作</th>
		 
						</tr>
						<s:iterator value="operLogList">
							<tr>
							<td><s:property value="operTime"/>&nbsp;</td>
							<td><s:property value="operIp"/>&nbsp;</td>
							<td><s:property value="loginName"/>&nbsp;</td>
							<td><s:property value="operAct"/>&nbsp;</td>
							</tr>
						</s:iterator>
					</tbody>
				</table>
			</div>
		</div>
		<div class="lightbtnbox"><input type="button" value="确认" id="lightsubmit" class="btnlist2" onclick="authorSet()"/></div>
	</div>
</div>
<!-- 上传 -->
<div style="display: none">
		<s:form name="uploadForm" id="uploadForm" target="hidden_frame"  enctype="multipart/form-data">
			<s:hidden name="picturePhysicalPath"></s:hidden>
			<!-- <input name="uploadType" type="hidden"/> -->
		<s:if test="site.siteId==null"><s:property value="site.siteId"/>
			<div class="padding6-14" style="margin-top:1px;margin-left:140px;" id="upimg_div">
		</s:if>
		<s:else>
			<div class="padding6-14" style="margin-top:0px;margin-left:140px;" id="upimg_div">
		</s:else>
				    <table id="upBanner">
					<tr>
						<td height=30>
							<s:file name="upload"  id='bester' cssClass="normal w350" onchange="onUploadImgChange(this.value,this)" size="85" cssStyle="hight:200px;"/>
						</td>
					</tr>
					<tr>
						<td>
							<div class="t_img3" id="preview_fake" >
				                 <s:if test="site.logo!=null">
				                 	<img src="<s:property value="uploadUrl"/><s:property value="site.banner"/>" title="<s:text name="site.banner"/>" id="pictemp2" />
				                 </s:if>
				                 <s:else> 
				                 	<img src="${ctx}/imgs/front/zw_tu.png" title="<s:text name="site.banner"/>"  id="pictemp2"  />
				                 </s:else>
               				</div>
						</td>
					</tr>
					<iframe name='hidden_frame' id='hidden_frame' style='display:none'></iframe>
				</table>                   
			 </div>
		</s:form>
</div>
<!-- end -->
</body>
</html>
<script type="text/javascript" defer="defer">
			var isNotSave=true;
			$("#operLog").click(function(){
				$$.shade("#operLog","#lightclose,#lightsubmit","#lightbox","600");
			});

			window.onunload = function (){
				<s:if test="linkContent.contentId!=null">
				if(isNotSave){
					$.post("content-ajaxunlock.action?content.contentId=<s:property value="linkContent.contentId"/>&status=<s:property value="status"/>");
				}
				</s:if>
			}
		$("#contentTitle").blur(function(){
			var maxLen=100;
			var contentTitle=$("#contentTitle").val();
			
			str = jQuery.trim(contentTitle);
			document.getElementById("contentTitle").value=str;
			 
			contentTitle=$.trim(contentTitle);
			if((contentTitle==""||contentTitle.length==0)){
				$("#contentTitleno").html("文章标题不能为空");
				$("#contentTitleno").css("color","red");
			}
			if(contentTitle!=""){
				$("#contentTitleno").html("");
			}
			if ((contentTitle.length )> maxLen) {
				var ss=$("#contentTitle").val( $("#contentTitle").val().substr(0, maxLen) );
				$("#contentTitleno").html("文章标题过长");
				$("#contentTitleno").css("color","red");
			}
		});
		$("#contentSource").blur(function(){
			var maxLen=100;
			var contentSource=$("#contentSource").val();
			
			str = jQuery.trim(contentSource);
			document.getElementById("contentSource").value=str;
			
			contentSource=$.trim(contentSource);
			if((contentSource==""||contentSource.length==0)){
				$("#contentSourceno").html("文章来源不能为空");
				$("#contentSourceno").css("color","red");
			}
			if(contentSource!=""){
				$("#contentSourceno").html("");
			}
			if ((contentSource.length )> maxLen) {
				var ss=$("#contentSource").val( $("#contentSource").val().substr(0, maxLen) );
				$("#contentSourceno").html("字符过长");
				$("#contentSourceno").css("color","red");
			}
		});
		$("#keywords").blur(function(){
				var maxLen=100;
				var keywords=$("#keywords").val();
				
				str = jQuery.trim(keywords);
				document.getElementById("keywords").value=str;
				
				keywords=$.trim(keywords);
				if ((keywords.length )> maxLen) {
					var ss=$("#keywords").val( $("#keywords").val().substr(0, maxLen) );
					$("#keywordsno").html("字符过长");
					$("#keywordsno").css("color","red");
				}
		});

		$("#linkUrl").blur(function(){
			var linkUrl=$("#linkUrl").val();
			
			str = jQuery.trim(linkUrl);
			document.getElementById("linkUrl").value=str;
		
			linkUrl=$.trim(linkUrl);
			if(linkUrl==""||linkUrl.length==0){
				$("#linkUrlno").html("链接不能为空");
				$("#linkUrlno").css("color","red");
		
			}else{
				$("#linkUrlno").html("");
				$("#linkUrlno").css("color","red");
			
			}
		});	

	$('#save').click(function(){
				var contentTitle = $("#contentTitle").val();
				var contentDescription = $("#contentDescription").val();
				var linkUrl=$("#linkUrl").val();
				var contentSource = $("#contentSource").val();
				contentTitle=$.trim(contentTitle);
				contentDescription=$.trim(contentDescription);
				linkUrl=$.trim(linkUrl);
				if(contentTitle==""){
					alert('请输入文章标题');
					return false;
				}
				if(contentDescription==""){
					alert('请输入简述内容');
					return false;
				} 
				if(contentSource==""){
					alert('请输入文章来源');
					return false;
				}
				if(linkUrl==""||linkUrl==null){
					alert('请输入连接 ');
					return false;
				} 
				
			});
	$(document).ready(function() {
		<s:if test="linkContent.simpleTitle1==null">
			$("#simpleT_1").hide();
		</s:if>
		<s:if test="linkContent.simpleTitle2==null">
			$("#simpleT_2").hide();
		</s:if>
		<s:if test="linkContent.simpleTitle3==null">
			$("#simpleT_3").hide();
		</s:if>
		if($("input[name=linkContent.isTop]").val()=="false"||$("input[name=linkContent.isTop]").val()==""){
			$("input[name=isTop_f]").attr("checked","");
		}else{
			$("input[name=isTop_f]").attr("checked","checked");
		}
		var showType = $("input[name=linkContent.showType]").val();
		$("input[name=showType_o]").each(function(i){
			if(showType.charAt(i)=="1"){
				$(this).attr("checked","checked");
			}
		});
		var tpl = "<s:property value="content.category.catContentTplSet"/>";
		if(tpl==""){
			$("select[name=linkContent.contentTpl] option").remove();
			var str = "<option value=''>默认模板</option>";
			$("select[name=linkContent.contentTpl]").append(str);
		}else{
			var obj = tpl.split(",");
			var str = "<option value=''>默认模板</option>";
			for(var i = 0 ; i < obj.length ; i++){
				str+="<option value="+obj[i]+">"+obj[i]+"</option>";
			}
			$("select[name=linkContent.contentTpl]").append(str);
		}
		if($("textarea[name=pictureContent.publishSug]").val()==""){
			$("#keywordssug").show();
		}else{
			$("#keywordssug").hide();
		}
	});
	function chkform(){
		var linkContentTitle = $("input[name=linkContent.contentTitle]").val();
		var linkUrl = $("input[name=linkContent.linkUrl]").val();
		if(linkContentTitle==""){
			alert("请输入文章标题！");
			return false;
		}
		if(linkUrl==""){
			alert("请输入文章链接！");
			return false;
		}
		if($("input[name=isTop_f]").attr("checked")==""){
			$("input[name=linkContent.isTop]").val(false);
		}else{
			$("input[name=linkContent.isTop]").val(true);
		}
		var showType = "0";
		$("input[name=showType_o]").each(function(){
			if($(this).attr("checked")==""){
				showType+="0";
			}else{
				showType+="1";
			}
		});
		$("input[name=linkContent.showType]").val(showType);
		var contentTitle=$("#contentTitle").val();
		var contentDescription=$("#contentDescription").val();
		if(contentTitle==''||contentTitle==null){
			return false;
		}
		if(contentDescription==''||contentDescription==null){
			return false;
		}
	
		isNotSave=false;
	}
	function goAudit(){
		if($('select[name=linkContent.contentStatus] option:selected').val()==''){
			$("#audit_status").show();
			return false;
		}
		else if($('select[name=linkContent.contentStatus] option:selected').val()==2){
			$("#audit_status").hide();
			if($("textarea[name=linkContent.publishSug]").val()==""){
				$("#keywordssug").show();
				return false;
			}else{
				$("#keywordssug").hide();
			}
		}
		var cflag = $('select[name=linkContent.contentStatus]').val();
		$("input[name=content.contentStatus]").val($("select[name=linkContent.contentStatus] option:selected").val());
		$("input[name=content.publishSug]").val($("textarea[name=linkContent.publishSug]").val());
		$('#cflag').val(cflag);
		isNotSave=false;
		$('#save-form').submit();
		
	}
	function addSimpleTitle(){
		if($("#simpleT_1").attr("name")!="show"){
			$("#simpleT_1").attr("name","show");
			$("#simpleT_1").show();
		}else if($("#simpleT_2").attr("name")!="show"){
			$("#simpleT_2").attr("name","show");
			$("#simpleT_2").show();
		}else if($("#simpleT_3").attr("name")!="show"){
			$("#simpleT_3").attr("name","show");
			$("#simpleT_3").show();
		}else{
			alert("只可增加3个幅标题！");
		}
	}
	function removeSimpleTitle(obj){
		$("#"+obj).hide();
		$("#"+obj).attr("name","hide");
		$("#"+obj+" input").val('');
	}
	
	//文章简述判空
	function checkDes(){
		var decCont =  $("#contentDescription").val();
		
		 str = jQuery.trim(decCont);
		 document.getElementById("contentDescription").value=str;
		 
		if(decCont == null  || decCont == ""){
			$("#desPoint").css("color","red");
			$("#desPoint").html("文章简述不能为空");
		}else{
			$("#desPoint").html("");
		}
	}
	
	
  function contentAuthor(str){
        str = jQuery.trim(str.value);
        document.getElementById("linkContent.contentAuthor").value=str;
	}
   function simpleTitle1(str){
		 str = jQuery.trim(str.value);
		 document.getElementById("content.simpleTitle1").value=str;
   }
   function simpleTitle2(str){
		 str = jQuery.trim(str.value);
		 document.getElementById("content.simpleTitle2").value=str;
   }
   function simpleTitle3(str){
		 str = jQuery.trim(str.value);
		 document.getElementById("content.simpleTitle3").value=str;
   }
   
   //上传附件
   function up1(){
	   $("#bester").click();
   }
   
   function checkFileExt(ext)
	{
	    if (!ext.match(/.jpg|.gif|.png|.bmp/i)) {
	        return false;
	    }
	    return true;
	}
   
   var isPass = false;
	function onUploadImgChange (url, sender) {
		var agent=window.navigator.userAgent;
		var isIE8 = agent.indexOf('MSIE 8.0') != -1;
		var objPreviewFake = document.getElementById( 'preview_fake' );
		var fileExt = url.substring(url.lastIndexOf(".")).toLowerCase();
		if(!checkFileExt(fileExt)) {
			alert("您上传的文件不是图片,请重新上传！");
			return false;
		}
		if( sender.files &&  sender.files[0] ){
			//在fireFox和chrome中。浏览器实现了File Api，是调用FileReader接口，readAsDataURL()用来读文件，onload事件为文件读取成功后触发
			if(sender.files[0].size > 1024*100) {
				alert("您上传的文件过大,请上传小于100k的图片！");
				isPass = false;
			}else {
				isPass = true;
			}
		}else if(isIE8 && objPreviewFake.filters ){
			// IE7,IE8 在设置本地图片地址为 img.src 时出现莫名其妙的后果
			//（相同环境有时能显示，有时不显示），因此只能用滤镜来解决图片预览，用ActiveXObject来获取图片大小
			// IE7, IE8因安全性问题已无法直接通过 input[file].value 获取完整的文件路径
			sender.select();
			var imgSrc = document.selection.createRange().text;
			var fso = new ActiveXObject("scripting.filesystemobject");
			//读取图片文件大小
			if(fso.GetFile(imgSrc).size >= 1024*100){
				alert("您上传的文件过大,请上传小于100k的图片！");
				isPass = false;
			}else {
				isPass = true;
			}
		}else {
			//IE环境下
			sender.select();
			var imgSrc = document.selection.createRange().text;
			//读取图片文件大小
			var sh = setInterval(function(){
				var img = document.createElement("img");
				img.src = imgSrc;
				var fileSize = img.fileSize;
				if (fileSize > 0){
					 if(fileSize > 1024*100) {
					        alert("您上传的文件过大,请上传小于100Kb的图片！");
					        clearInterval(sh);
					 }else {
						clearInterval(sh);
						var height=$('body').height()+71;
						$("body",parent.document).append('<div class="loading"><img src="imgs/loading_cms.gif" class="mb14" /><p class="c_fff">正在上传 请稍后 . . . </p></div><div class="shadow" style="height:'+height+'px;width:100%;"><iframe scrolling="no" height="'+height+'" frameborder="0" width="100%"   style="position:absolute;z-index:-1;border:none;filter:alpha(opacity=0);"></iframe></div>');
						var thisForm = sender.form;
						thisForm.action = "${ctx}/content/save-picture.action?url="+encodeURI(url);
						thisForm.submit();
						show_hide();
					 }
				}
				img = null;
			},100);
		}
		if(isPass) {
			$("body",parent.document).append('<div class="loading"><img src="imgs/loading_cms.gif" class="mb14" /><p class="c_fff">正在上传 请稍后 . . . </p></div><div class="shadow" style="height:100%;width:100%;"></div>');
			var thisForm = sender.form;
			thisForm.action = "${ctx}/content/save-picture.action?url="+encodeURI(url);
			thisForm.submit();
			show_hide();
		}
	}
	
	function show_hide(){
		$("#selectPic").hide();
		$("#preview_fake").show();
		$("#insert").show();
	}
	
	var attachUrl = $("#attachUrl").val();
	if(attachUrl != null && attachUrl != ""){
		$("#selectPic").hide();
		$("#preview_fake").show();
		$("#insert").show();
	}
	
</script>